# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Matt Smith <mcs@darkregion.net>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=duplicity
pkgver=2.1.4
pkgrel=0
pkgdesc="Encrypted bandwidth-efficient backup using the rsync algorithm"
url="https://duplicity.gitlab.io/duplicity-web/"
arch="all"
license="GPL-2.0-or-later"
depends="python3 py3-boto3 gpg gpg-agent ncftp py3-fasteners py3-future"
makedepends="python3-dev py3-setuptools librsync-dev gettext py3-wheel py3-gpep517"
checkdepends="py3-pytest py3-pexpect"
subpackages="$pkgname-pyc $pkgname-doc $pkgname-lang"
source="https://gitlab.com/duplicity/duplicity/-/archive/rel.$pkgver/duplicity-rel.$pkgver.tar.bz2"
builddir="$srcdir/duplicity-rel.$pkgver"

prepare() {
	default_prepare

	# their version setting is broken
	sed -i "s|\$version|$pkgver|" duplicity/__init__.py
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest testing/unit \
		--ignore testing/unit/test_cli_main.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
711330e2c039ca111f2a0d4e2bcef4dc9ab60cb12ab6dc12e852a2f1b4fff02ab34cedf2b317c5b9790d501fbf129ff1678eeffc15a4707526b359524744d265  duplicity-rel.2.1.4.tar.bz2
"
